<div id="copyBar" style="display: none;">
    <div class="copy-bar">
        <div id="copyBarTitle" class="copy-title">推文html</div>
        <div class="copy-content">
            <textarea id="copyContent" class="copy-textarea"></textarea>
        </div>
        <div class="copy-button">
            <div class="copy-button-ok" onclick="getCopyContent()">复制</div>
            <div class="copy-button-cancel" onclick="closeCopyBar()">取消</div>
        </div>
    </div>
</div>

<script type="text/javascript">
    var copyBar = null;

    function initCopyBar() {
        copyBar = getHtml('copyBar');
        setHtml('copyBar', '');
    }

    function openCopyBar(content, width = '600px', height = 'auto', offsetX = '70px', offsetY = lyFloatLeft) {
        openFloat(width, height, offsetX, offsetY, copyBar);
        setValue('copyContent', content);
        getItem('copyContent').select();
    }

    function closeCopyBar() {
        closeFloat();
    }

    function setCopyTitle(title) {
        setHtml('copyBarTitle', title);
    }

    function getCopyContent() {
        var input = document.createElement('input');
        input.style.position ='fixed';
        input.style.opacity = 0;
        input.value = getValue('copyContent');

        document.body.appendChild(input);
        input.select();
        document.execCommand('copy');
        document.body.removeChild(input);

        closeCopyBar();
    }
</script>

<style type="text/css">
    .copy-bar
    {
        width: 600px;
        background-color: white;
    }

    .copy-title
    {
        height: 40px;
        line-height: 40px;
        color: #31708f;
        font-size: 18px;
        background-color: #ececec;
        padding-left: 10px;
    }

    .copy-content
    {
        height: 500px;
        background-color: white;
        padding: 10px 10px 10px 10px;
        border-bottom: 1px solid #e5e5e5;
    }

    .copy-textarea
    {
        width: 100%;
        height: 100%;
        border: none;
        color: #333333;
        background-color: white;
        resize: none;
    }

    .copy-button
    {
        height: 50px;
        text-align: center;
        padding-top: 20px;
        background-color: white;
    }

    .copy-button-ok
    {
        width: 95px;
        height: 35px;
        line-height: 35px;
        color: white;
        font-size: 14px;
        text-align: center;
        background-color: #EC9E14;
        cursor: pointer;
        margin-left: 200px;
        margin-right: 10px;
        border-radius: 5px;
        float: left;
    }

    .copy-button-cancel
    {
        width: 95px;
        height: 35px;
        line-height: 35px;
        color: #333333;
        font-size: 14px;
        text-align: center;
        background-color: #cccccc;
        cursor: pointer;
        border-radius: 5px;
        float: left;
    }
</style>